package o2o.delivery.service;

import com.jinyouapp.common.utils.security.EncrypAES;
import lombok.extern.slf4j.Slf4j;
import org.springframework.stereotype.Service;

/**
 * @author Jahnke【1029777564@qq.com】
 * @ClassName DeliveryAuthService
 * @Description:
 * @date 2021/1/26 15:40
 * @Version 1.0
 */
@Service
@Slf4j
public class DeliveryAuthService {

    // 解析token
    public String getKey(String encrypt) {
        if (!encrypt.endsWith("=")) {
            encrypt = encrypt + "=";
        }
        String decrypt = null;
        try {
            decrypt = EncrypAES.aesDecrypt(encrypt, EncrypAES.KEY + "p");
        } catch (Exception e) {
            e.printStackTrace();
            log.info("token解析失败，原因==>{}",e.getMessage());
        }
        return decrypt;
    }

    public static void main(String[] args) throws Exception {
        DeliveryAuthService service = new DeliveryAuthService();
        System.out.println(service.getKey("AVIFThNVzacjVGk6Frl8BjCTztNNt75ZWAbZV18wFKM"));
        String s = EncrypAES.aesEncrypt("oth1_kaopusong", EncrypAES.KEY + "p");
        System.out.println(s);
    }
}
